package com.qdlc.p2p.biz.executer.impl;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.qdlc.p2p.biz.executer.BaseExecuter;
import com.qdlc.p2p.biz.service.ExperienceBorrowService;
import com.qdlc.p2p.common.constant.Global;
import com.qdlc.p2p.common.util.BeanUtil;
import com.qdlc.p2p.dal.dto.Borrow;

/**
 * 借款标初审
 * 开启体验券投标业务处理
 * @author xxx
 * @version 2.0
 * @date 2015年4月27日 下午6:50:03
 */
@Service
@Scope(value=ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ExperienceVerifyExecuter extends BaseExecuter {

	@Override
	public void extend() {
		Object obj = Global.getTransfer().get("borrow");
		Object obj_mostExperience = Global.getTransfer().get("mostExperience");
		Object obj_mostExperienceSingle = Global.getTransfer().get("mostExperienceSingle");
		if(obj != null && obj_mostExperience != null && obj_mostExperienceSingle != null){
			Borrow borrow = (Borrow) obj;
			double mostExperience = Double.parseDouble(obj_mostExperience.toString());
			double mostExperienceSingle = Double.parseDouble(obj_mostExperienceSingle.toString());
			ExperienceBorrowService experienceBorrowService = (ExperienceBorrowService)BeanUtil.getBean("experienceBorrowService");
			experienceBorrowService.save(borrow, mostExperience, mostExperienceSingle);
			
		}
	}

}
